/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cr.ac.una.sive.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author claribel
 */
@Entity
@Table(name = "REGISTRO_VEHICULO", catalog = "", schema = "UNA_SIVE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RegistroVehiculo.findAll", query = "SELECT r FROM RegistroVehiculo r"),
    @NamedQuery(name = "RegistroVehiculo.findByIdRegistroVehiculo", query = "SELECT r FROM RegistroVehiculo r WHERE r.idRegistroVehiculo = :idRegistroVehiculo"),
    @NamedQuery(name = "RegistroVehiculo.findByPlaca", query = "SELECT r FROM RegistroVehiculo r WHERE r.placa = :placa"),
    @NamedQuery(name = "RegistroVehiculo.findByFecha", query = "SELECT r FROM RegistroVehiculo r WHERE r.fecha = :fecha"),
    @NamedQuery(name = "RegistroVehiculo.findByHoraEntrada", query = "SELECT r FROM RegistroVehiculo r WHERE r.horaEntrada = :horaEntrada"),
    @NamedQuery(name = "RegistroVehiculo.findByHoraSalida", query = "SELECT r FROM RegistroVehiculo r WHERE r.horaSalida = :horaSalida")})
public class RegistroVehiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SQREGISTRO_VEHICULO")
    @SequenceGenerator(name="SQREGISTRO_VEHICULO", sequenceName = "SQ_REGISTRO_VEHICULO",allocationSize=1)
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_REGISTRO_VEHICULO", nullable = false, precision = 0, scale = -127)
    private BigDecimal idRegistroVehiculo;
    @Size(max = 100)
    @Column(name = "PLACA", length = 100)
    private String placa;
    @Column(name = "FECHA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "HORA_ENTRADA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaEntrada;
    @Column(name = "HORA_SALIDA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaSalida;
    @JoinColumn(name = "PARQUEO", referencedColumnName = "ID_PARQUEO", nullable = false)
    @ManyToOne(cascade= CascadeType.ALL,optional = false, fetch = FetchType.EAGER)
    private Parqueo parqueo;

    public RegistroVehiculo() {
    }

    public RegistroVehiculo(BigDecimal idRegistroVehiculo) {
        this.idRegistroVehiculo = idRegistroVehiculo;
    }

    public BigDecimal getIdRegistroVehiculo() {
        return idRegistroVehiculo;
    }

    public void setIdRegistroVehiculo(BigDecimal idRegistroVehiculo) {
        this.idRegistroVehiculo = idRegistroVehiculo;
    }

    public String getPlaca() {
        return placa;
    }

    public void setPlaca(String placa) {
        this.placa = placa;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getHoraEntrada() {
        return horaEntrada;
    }

    public void setHoraEntrada(Date horaEntrada) {
        this.horaEntrada = horaEntrada;
    }

    public Date getHoraSalida() {
        return horaSalida;
    }

    public void setHoraSalida(Date horaSalida) {
        this.horaSalida = horaSalida;
    }

    public Parqueo getParqueo() {
        return parqueo;
    }

    public void setParqueo(Parqueo parqueo) {
        this.parqueo = parqueo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRegistroVehiculo != null ? idRegistroVehiculo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegistroVehiculo)) {
            return false;
        }
        RegistroVehiculo other = (RegistroVehiculo) object;
        if ((this.idRegistroVehiculo == null && other.idRegistroVehiculo != null) || (this.idRegistroVehiculo != null && !this.idRegistroVehiculo.equals(other.idRegistroVehiculo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cr.ac.una.sive.entidad.RegistroVehiculo[ idRegistroVehiculo=" + idRegistroVehiculo + " ]";
    }
    
}
